/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MiniCurso.modelo;

import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Gabriel Lunardi
 */
public class Usuario {

    public static boolean isUsuarioValido(String usuario, String senha) {
        String user = "admin";
        String pass = "admin";

        if ((usuario.equals(user)) && (senha.equals(pass))) {
            
            return true;
        }
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Login/Senha não cadastrados!", null));
        return false;
    }

    public static HttpSession getSession() {
        ExternalContext extCon = FacesContext.getCurrentInstance().getExternalContext();
        HttpSession session = (HttpSession) extCon.getSession(true);
        return session;
    }
}
